/**
 * @Author: lifuzhao
 * @Date: 2019-08-06
 * @Project: shop_cms
 */
import store from '../vuex/index'
import autoTitle from './decorators/autoTitle'
class Guard {
  constructor(Vue) {
    this.instance = Vue
  }
  @autoTitle
  beforeEach(to, from, next) {
    let state = store.state
    if(to.fullPath !== '/login' && !state.token){
      next('/login')
    }else{
      next()
    }
  }
}

export default Guard
